﻿@{
    ViewData["Title"] = "Add";
    Layout = null;
}

<link rel="stylesheet" href="~/layui/css/layui.css">
@*引用*@
<script src="~/Scripts/jquery-3.4.1.min.js"></script>
<script src="~/layer/Model/appsettings.js"></script>
<script src="~/layui/layui.js"></script>


<div style="width:800px">
    <form class="layui-form" action="/Violation/updaterole">

        <div class="layui-form-item">
            <div class="layui-input-block">
                <input id="Id" name="Id" type="hidden" value="@ViewBag.id" />
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">违章标题：</label>
            <div class="layui-input-block">
                <input type="text" id="Title" name="Title" required lay-verify="required" placeholder="请输入违章标题" autocomplete="off" class="layui-input">
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">车牌号：</label>
            <div class="layui-input-block">
                <input type="text" id="VehicleId" name="VehicleId" required lay-verify="required" placeholder="请输入车牌号" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">违章人</label>
            <div class="layui-input-block">
                <input type="text" id="Person" name="Person" required lay-verify="required" placeholder="请输入违章人" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">违章日期：</label>
            <div class="layui-input-block">
                <input type="text" id="Date" name="Date" required lay-verify="required" placeholder="请输入保养日期" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">违章内容：</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入违章内容" id="Content" name="Content" class="layui-textarea"></textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">处罚结果</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入处罚结果" id="Result" name="Result" class="layui-textarea"></textarea>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">备注：</label>
            <div class="layui-input-block">
                <textarea placeholder="请输入备注" id="Remark" name="Remark" class="layui-textarea"></textarea>
            </div>
        </div>


        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" type="submit" lay-submit>立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary" onclick="tz()">返回</button>
            </div>
        </div>
    </form>
</div>

<script>
    //Demo
layui.use('form', function(){
  var form = layui.form;
  form.render();
  //监听提交

  form.on('submit(formDemo)', function(data){
  });
});

var tz=function(){
    location.href="/Violation/Index"
}

$(function () {
            $.ajax({
                url: "/Violation/GetBack?id=" + @ViewBag.id,
                type: "get",
                dataType: "json",
                success: function (obj) {
                    $("#Title").val(obj.title)
                    $("#VehicleId").val(obj.vehicleId)
                    $("#Person").val(obj.person)
                    $("#Content").val(obj.content)
                    $("#Result").val(obj.result)
                    $("#Date").val(obj.date)
                    $("#Remark").val(obj.remark)
                }
            })
        })
</script>




